﻿using System;
using System.Collections.Generic;
using System.Xml;

namespace DNMeter.dom
{
	public class TestElementProperty
	{
		protected XmlElement elementProp;
		internal string Name;
		internal object Value;
		internal string Type;
		public TestElementProperty(XmlElement elem)
		{
			this.elementProp = elem;
			Name = elem.GetAttribute("name");
			Value = elem.InnerText;
			Type = elem.Name;
		}

	}
	public class TestElementElementProperty : TestElementProperty
	{

		internal string ElementType;
		internal bool Enabled;
		internal string TestName;
		internal List<TestElementProperty> properties;


		public TestElementElementProperty(XmlElement elem)
			: base(elem)
		{
			ElementType = elementProp.GetAttribute("elementType");
			Enabled = Boolean.Parse(elementProp.GetAttribute("enabled"));
			TestName = elementProp.GetAttribute("testname");
			properties = new List<TestElementProperty>();
			foreach ( XmlNode node in elementProp.ChildNodes ){
				TestElementProperty prop = new TestElementProperty((XmlElement)node);
				properties.Add(prop);
			}
			Value = properties ;
		}
	}
}
